package com.zhuiyun.pm.client.login.utils;/**
 * @author syc
 * @date 2023/3/31 9:54
 */

import java.util.Arrays;

/**
 * @ClassName mp
 * @Description TODO
 * @Author sgo
 * @Date 2023/3/31 9:54
 **/
public class mp {
    public static void main(String[] args) {
        int[] arr=new int[4];
        arr[0]=10;  arr[1]=4;  arr[2]=0;  arr[3]=2;
        for (int i = 0; i <arr.length-1; i++) {

            //标志位
            boolean flag = true;

            for (int j = 0; j <arr.length-1-i ; j++) {

                if(arr[j] > arr[j+1]){
                    int temp = arr[j+1];
                    arr[j+1] = arr[j];
                    arr[j] = temp;
                    flag = false;
                }
            }

            //当不再发生交换时，则结束比较
            if(flag){
                break;
            }
        }
        System.out.println("%d"+ Arrays.toString(arr));

    }
}
